/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.cjb.malacma.rssfeed.util;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;


/**
 *
 * @author malacma
 */
public class FeedFactory {

    private static URL feedUrl;
    private static SyndFeed feed;
    private static SyndFeedInput input;

    public static SyndFeed getInstance(String feedHttp) throws MalformedURLException, IllegalArgumentException, FeedException, IOException {
        //Abre a URL do RSS Feed
        feedUrl = new URL(feedHttp);

        //Cria uma entrada de Feed
        input = new SyndFeedInput();

        //Cria o feed
        feed = input.build(new XmlReader(feedUrl));


        return feed;

    }
}
